#include <map>
#include <mutex>
#include <functional>
#include "Util/util.h"
#include "jsoncpp/json.h"
#include "Network/Buffer.h"

using namespace Fdt;

class  CurtainServer{
public:
	static CurtainServer* instance(){
		if(s_CurtainServer == nullptr){
			s_CurtainServer = new CurtainServer();
		}
		return s_CurtainServer;
	}

	~CurtainServer(){}
	void RegistRPC();
	bool GetDeviceCapacity(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);
	bool GetStreamType(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);
	bool SetCurtainLayout(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);
	bool SetPlayStrategy(const Json::Value &request, const Fdt::BufferMap::Ptr &inMap, Json::Value &response, Fdt::BufferMap::Ptr &outMap);
	bool SetDeviceShareStatus(const Json::Value& request, const Fdt::BufferMap::Ptr& inMap, Json::Value& response, Fdt::BufferMap::Ptr& outMap);
	bool GetCurtainLayout(const Json::Value &request, const BufferMap::Ptr &inMap, Json::Value &response, BufferMap::Ptr &outMap);
	bool GetOutputInterface(const Json::Value &request, const BufferMap::Ptr &inMap, Json::Value &response, BufferMap::Ptr &outMap);
	bool GetMirrorPinCode(const Json::Value &request, const BufferMap::Ptr &inMap, Json::Value &response, BufferMap::Ptr &outMap);
	bool CloseCurrentLayout(const Json::Value &request, const BufferMap::Ptr &inMap, Json::Value &response, BufferMap::Ptr &outMap);

protected:
	CurtainServer();
private:
	static CurtainServer * s_CurtainServer;
};
